<script>
export default {
  // props: ['username', 'content', 'likes']
  props : ['comment'],
  methods: {
    like() {
      console.log("点赞")
      this.$emit('upvote', this.comment.id)
    }
  }
}
</script>

<template>
<div class="container">
  <span>{{comment.username}}</span>:
  <span>{{comment.content}}</span>
  <span>({{comment.likes}}喜欢)</span>
  <button @click="like" style="color: red">♥</button>
</div>
</template>

<style scoped>
.container {
  width: 80%;
  margin: 0 auto;
}
</style>